package com.itfreer.print.base.itextpdf.textbefore;

import com.itextpdf.text.Document;
import com.itextpdf.text.pdf.PdfWriter;
import com.itfreer.print.base.itextpdf.ITextBefore;

/**
 * 设置创建者信息
 */
public class CreatorInfoTextBefore implements ITextBefore {
	
	/**
	 * 标题
	 */
	private String title = "小包科技pdf打印输出";
	/**
	 * 作者
	 */
	private String author = "小包科技";
	/**
	 * 应用程序名称
	 */
	private String creator = "小包科技";
	/**
	 * 主题
	 */
	private String subject = "小包科技pdf打印输出";
	/**
	 * 关键字
	 */
	private String keywords = "小包科技";
	
	public CreatorInfoTextBefore(){
		
	}
	
	public CreatorInfoTextBefore(String title, String author, String creator, String subject, String keywords){
		this.title = title;
		this.author = author;
		this.creator = creator;
		this.subject = subject;
		this.keywords = keywords;
	}
	
	/**
	 * 文档操作
	 * @param pdfDocument
	 * @param pdfWriter
	 */
	public void doOptions(Document pdfDocument, PdfWriter pdfWriter){
		if (pdfDocument == null) {
			return;
		}
		// 文档属性
		pdfDocument.addTitle(title);
		pdfDocument.addAuthor(author);
		pdfDocument.addSubject(subject);
		pdfDocument.addKeywords(keywords);
		pdfDocument.addCreator(creator);// 
	}
}
